<template>
  <div>
    <el-container>
      <el-aside width="200px" class="aside">
        <ul>
          <li v-for="item in directory" :key="item.id" @click="toContent(item.url, item.id)">
            {{ item.title }}
          </li>
        </ul>
      </el-aside>
      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()

const directory = ref([
  { id: 0, title: '第一章', url: '/course/test1' },
  { id: 1, title: '第二章', url: '/course/test2' },
  { id: 2, title: '第三章', url: '/course/test1' },
  { id: 3, title: '第四章', url: '/course/test1' },
  { id: 4, title: '第五章', url: '/course/test1' },
  { id: 5, title: '第六章', url: '/course/test1' },
  { id: 6, title: '第七章', url: '/course/test1' },
  { id: 7, title: '第八章', url: '/course/test1' },
  { id: 8, title: '第九章', url: '/course/test1' },
  { id: 9, title: '第十章', url: '/course/test1' }
])

const toContent = (url, id) => {
  console.log(url)
  // router.push({ path: url, query: { id } })
}
</script>

<style lang="scss" scoped>
@import url('../../styles/cource/index.scss');
</style>
